import Vue from 'vue'
import VueRouter from 'vue-router'

import phoneRegister from '../views/PhoneRegister.vue'
import phoneLogin from '../views/PhoneLogin.vue'
import sortingLogin from '../views/SortingLogin.vue'
import distribution from '../components/Distribution.vue'
import distributionLogin from '../views/DistributionLogin.vue'

import Sreach from '../components/Sreach.vue'
import Index from '../views/Index.vue'
const firstPage= () => import('../views/FirstPage.vue')
const type= () => import('../components/Type.vue')
const carts= () => import('../components/Carts.vue')
const my= () => import('../components/My.vue')
const nextType= () => import('../components/NextType.vue')
const goodDatail = () => import('../components/GoodsDetail.vue')
const goodsInformation = () => import('../components/GoodsInformation.vue')
const score = () => import('../components/Score.vue')
const distributionBoard = () => import('../components/DistributionBoard.vue')
const distributionWork = () => import('../components/DistributionWork.vue')
const distributionMine = () => import('../components/DistributionMine.vue')
//const recommend = () => import('../components/recommend.vue')
const orders = () => import('../components/Orders.vue')
const orderDetails = () => import('../components/OrderDetails.vue')

const browseHistory = () => import('../components/BrowseHistory.vue')
const address = () => import('../components/Address.vue')
const myOrders=() =>import('../components/MyOrders.vue')
const sorting=() =>import('../components/Sorting.vue')
const sortingMine=() =>import('../components/SortingMine.vue')
const sortingPerformanceBoard=() =>import('../components/SortingPerformanceBoard.vue')
const sortingWorkBench=() =>import('../components/SortingWorkBench.vue')
const rotograph=() =>import('../components/Rotograph.vue')
const tagPage=() =>import('../components/TagPage.vue')
Vue.use(VueRouter)

const routes = [
  {
    path: '/phoneRegister',
    name: 'phoneRegister',
    component: phoneRegister
  },
  {
    path: '/',
    name: 'phoneLogin',
    component: phoneLogin
  },
  {
    path: '/sortingLogin',
    name: 'sortingLogin',
    component: sortingLogin
  },
  {
    path: '/address',
    name: 'address',
    component: address
  },
  {
    path: '/distribution',
    name: 'distribution',
    component: distribution,
    //重定向到默认子组件
    redirect:'/distributionBoard',
    children:[{ path: '/distributionBoard',
    name: 'distributionBoard',
    component: distributionBoard,
    },{ path: '/distributionWork',
    name: 'distributionWork',
    component: distributionWork
    },{ path: '/distributionMine',
    name: 'distributionMine',
    component: distributionMine,
    }]
  },
  {
    path: '/distributionLogin',
    name: 'distributionLogin',
    component: distributionLogin
  },

  {
    path: '/index',
    name: 'index',
    component:Index,
    children:[
      {
        path:'/',
        component:firstPage
      },
      {path:'/firstPage',name:'firstPage',component:firstPage,meta:{activeNum:0}},
      {path:'/type', name:'type', component:type,meta:{activeNum:1},
      children:[
         
          {path:'/nextType',name:'nextType',component:nextType,
        
          children:[
              //{path:'/recommend',name:'recommend',component:recommend},
              {path:'/gooddetail',name:'gooddetail',component:goodDatail}
            ]
          }
      ]
    },
      {path:'/carts',name:'carts',component:carts,meta:{activeNum:2}},
      {path:'/orders',name:'orders',component:orders,},
      {path:'/orderDetails',name:'orderDetails',component:orderDetails,},
      {path:'/my',name:'my',component:my,meta:{activeNum:3}},

    ]
    
  },

  {
    path: '/sreach',
    name: 'sreach',
    component: Sreach
  },
  {
    path: '/browseHistory',
    name: 'browseHistory',
    component: browseHistory
  },

  {
    path: '/goodsInformation',
    name: 'goodsInformation',
    component: goodsInformation
  },

  {
    path: '/tagPage',
    name: 'tagPage',
    component: tagPage
  },

  {
    path: '/rotograph',
    name: 'rotograph',
    component: rotograph
  },

  {
    path: '/score',
    name: 'score',
    component: score
  },
  {
     path: '/myOrders',
      name: 'myOrders',
     component: myOrders
    },
    {
       path: '/sorting',
       name: 'sorting',
       component:sorting,
      children:[
      {path: '/sortingMine',
       name: 'sortingMine',
       component:sortingMine},
       {path: '/sortingPerformanceBoard',
       name: 'sortingPerformanceBoard',
       component:sortingPerformanceBoard},
      {path: '/sortingWorkBench',
       name: 'sortingWorkBench',
      component:sortingWorkBench},
      
       ]
      
    }
]

const router = new VueRouter({
  routes
})

export default router
